﻿// <copyright>
// Copyright (c) 2008 - 2009, Microsoft, All Rights Reserved
// </copyright>
//
// Licensed under the Microsoft Public License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at 
//
// http://www.opensource.org/licenses/ms-pl.html

namespace LiveLabs.Logging
{
    /// <summary>
    /// Log is where messages are written from Loggers.
    /// </summary>
    /// <remarks>
    /// All Log implementations should be usuable from multiple threads.
    /// </remarks>
    public abstract class Log
    {
        private volatile bool isLogging = true;

        /// <summary>
        /// Initializes a new instance of the Log class
        /// </summary>
        protected Log()
        {
        }

        /// <summary>
        /// Gets or sets a value indicating whether or not this Log should write messages.
        /// </summary>
        public virtual bool IsLogging
        {
            get { return this.isLogging; }
            set { this.isLogging = value; }
        }

        /// <summary>
        /// Writes the <paramref name="message"/> to some destination.
        /// </summary>
        /// <param name="message">The message to write</param>
        /// <param name="level">The <see cref="LogLevel"/> of the message.</param>
        /// <remarks>
        /// <para>
        /// See derivatives for specific details on log destination and
        /// configuration.
        /// </para>
        /// <para>
        /// Derivatives can use the <paramref name="level"/> as a hint of the
        /// importance of the message.
        /// </para>
        /// </remarks>
        public abstract void WriteLine(string message, LogLevel level);
    }
}
